package com.aynu.gulimall.cart.feign.fallback;

import com.aynu.common.exception.BizCodeEnume;
import com.aynu.common.utils.R;
import com.aynu.gulimall.cart.feign.ProductFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @author mj
 * @version 1.0
 * @date 2021/4/15 22:42
 */
@Component
@Slf4j
public class ProductFeignServiceFallback implements ProductFeignService {
    @Override
    public R info(Long skuId) {
        log.info("熔断方法调用");
        return R.error(BizCodeEnume.TO_MANY_REQUEST.getCode(),BizCodeEnume.TO_MANY_REQUEST.getMessage());
    }

    @Override
    public List<String> getSkuSaleAttrValues(Long skuId) {
        log.info("熔断方法调用");
        return new ArrayList<>();
    }

    @Override
    public BigDecimal getPrice(Long skuId) {
        log.info("熔断方法调用");
        return new BigDecimal("0.00");
    }
}
